package com.xingkeduo.util.pojo.enums;

import com.xingkeduo.util.pojo.base.BaseEnum;

/**
 * 学历学位枚举
 * 
 * @author GJ
 * @time 2018年12月29日 下午4:41:09
 * @description
 */
public enum DegreeEnum implements BaseEnum {
	ELEMENTARY(1, "小学"),
	MIDDLE(2, "初中"),
	HIGH(3, "高中"),
	MIDDLESPECIAL(4, "中专"),
	HIGHSPECIAL(5, "大专"),
	BECHELOR(6,"学士"),
	MASTER(7,"硕士"),
	PHD(8,"博士");

	private int value;
	private String desc;

	private DegreeEnum(int value, String desc) {
		this.value = value;
		this.desc = desc;
	}

	public static boolean validValue(String value) {
		int value_int = Integer.parseInt(value);
		return validValue(value_int);
	}

	public static boolean validValue(int value) {
		DegreeEnum[] degrees = DegreeEnum.values();
		for (int i = 0; i < degrees.length; i++) {
			if (degrees[i].getValue() == value)
				return true;
		}
		return false;
	}

	public static DegreeEnum getDegree(String value) {
		int value_int = Integer.parseInt(value);
		return getDegree(value_int);
	}

	public static DegreeEnum getDegree(int value) {
		DegreeEnum[] degrees = DegreeEnum.values();
		for (int i = 0; i < degrees.length; i++) {
			if (degrees[i].getValue() == value)
				return degrees[i];
		}
		return null;
	}

	@Override
	public int getValue() {
		return this.value;
	}

	public String getDesc() {
		return desc;
	}
}
